package net.chenlin.dp.modules.base.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.chenlin.dp.common.entity.Page;
import net.chenlin.dp.common.entity.Query;
import net.chenlin.dp.common.entity.R;
import net.chenlin.dp.common.utils.CommonUtils;
import net.chenlin.dp.modules.base.entity.SysRenwuEntity;
import net.chenlin.dp.modules.base.manager.SysRenwuManager;
import net.chenlin.dp.modules.base.service.SysRenwuService;

/**
 * 任务安排
 *
 * @author ZhouChenglin
 * @email yczclcn@163.com
 * @url www.chenlintech.com
 * @date 2018年12月15日 下午9:24:58
 */
@Service("sysRenwuService")
public class SysRenwuServiceImpl implements SysRenwuService {

	@Autowired
	private SysRenwuManager sysRenwuManager;

	@Override
	public Page<SysRenwuEntity> listSysRenwu(Map<String, Object> params) {
		Query query = new Query(params);
		Page<SysRenwuEntity> page = new Page<>(query);
		sysRenwuManager.listSysRenwu(page, query);
		return page;
	}

	@Override
	public R saveSysRenwu(SysRenwuEntity role) {
		int count = sysRenwuManager.saveSysRenwu(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getSysRenwuById(Long id) {
		SysRenwuEntity sysRenwu = sysRenwuManager.getSysRenwuById(id);
		return CommonUtils.msg(sysRenwu);
	}

	@Override
	public R updateSysRenwu(SysRenwuEntity sysRenwu) {
		int count = sysRenwuManager.updateSysRenwu(sysRenwu);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(Long[] id) {
		int count = sysRenwuManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
